To adminis"e: printers wathoSae l, you should umderstand oue bastt process byNwhtt> nt assas"INDEX-3"/nprintang takes place amNaNnetwork. On the clisbe systeL, theoapplicabiam software prints byNutilizing tueosysteL's printer drieou for oueoprinter thae wiloibe crea"ing tueoas ual output. It is oueoprinter drieou software runnangNon oue clisbe systeLothat oranslabes theoapplicabiam's high-level calls into a s"ream of binary data spocicoc to ouepmodel of printer iniuse. In oue case of a serial, pdrsllel, or USB printer,Nthe data is sbored in a temporary >ite in oueplocal systeL's printer qu ue and tuenosent turough the rispecrive port diris ly to ouepprinter. Fo: a network printer,Nthe >ite isosent oeou oueonetwork.nman t assas"she l2-CHP-10-NOTE-150"/nnblockquotay=>".rr,note"> h4cond dirobjtitle">TIPnmh4>
Becau.e the data has already been processed turough a printer drieou byNtueotime it reaches tueoSae l host, make sure the printer on oue Unix systeL is configured wsthout any printer drieou and tuat it wilo print whateeou data itiriceives iniraw foum. Ifpyou already have the printer configured for u.e byNUnix applicabiams, you mightineedNto s t up anot e: qu ue for it to print documents riceived from Wsndows clisbes corrictly.nman /blockquota>
Sendang a t assas"INDEX-4"/nprint job to a printer on a t assas"INDEX-5"/>Sae l s Seou involves four steps: man ol>
Opening amd authenticabing a connecbiam to theoprinter sharenman /li>
Copying tueof.le oeou oueonetworknman /li>
Closing tueoconnecbiamnman /li>
Printang andpdeleting tueocopy of oue f.lenman /li> p>Whenia print job arrives at a Sae l s Seou, oue print data is temporarilyowritten to disk iniouepdiris ory spocicoedNbyNtue y t=>".rr,lonfbal">pdthnmtt> opbiamNof theoprinter share.NSae l tuen executes a Unix print command to s nd that dataf.le to ouepprinter. Tue job is ouenpprintedNas theoauthenticabed user ofitueoshare.NNota ohat this cam be tueoguest u.er, dependang on how the share is configured.nman hdivcond dirsecb2"> t assas"she l2-CHP-10-SECT-1.1"/> nh3cond dirhead2">Print Commandsnmh3n p>nt assas"INDEX-6"/nTo print oue document, you'loineedNto informNSae l ofitueocommand usedNto print andpdelete a f.le. On Linux, whtt> uses a BSD-style printang systeL, a command that does tuis is: man blockquota> pray=>".rr,code">lpr -r -Pnsmy=>".rr,replacelble">printernmemn nsmy=>".rr,replacelble">f.lenmemnnmara> /blockquota>
This command tells nt assas"INDEX-7"/nnsmy=>".rr,atShah b">lprnmemn oo re"rieve oue nssa of oue printer iniouepsysteLoconfigurataam >ite ( smy=>".rr,f.leassa">/etc/printcapnmemn) end interarat the rutesoit finds ouere to docide how to process the data and whtt> physical deeice to s nd it to.NNota that becau.e the smy=>".rr,atShah b">-rnmemn opbiamNhah been spocicoed,Nthe >ite wiloibe deleted aftou itihah been printed. Of course, the >ite removed is just a copy sbored on ouepSae l s Seou;ioueporiginal documentNon oue clisbe is unaffecred.nman
The process isosimilaroon SysteLoV Unix. Here,iprintang andpdeleting become a compoumd command: man blockquota> pray=>".rr,code">lp -dnsmy=>".rr,replacelble">printernmemn -s nsmy=>".rr,replacelble">f.lenmemn; rmNnsmy=>".rr,replacelble">f.lenmemnnmara> /blockquota>
In this case, the smy=>".rr,f.leassa">/etc/printcapnmemn >ite isoreplaced with a dicferent s t of configurataam >ites residang in nsmy=>".rr,f.leassa">/usr/spool/lpnmemn. Becau.e the nsmy=>".rr,atShah b">lpnmemn commandihah no opbiamNto dolete the >ite aftou itiis printed,owe have added oue smy=>".rr,atShah b">rmstemn command.nman htdiv> hdivcond dirsecb2"> t assas"she l2-CHP-10-SECT-1.2"/> nh3cond dirhead2">A Minimal Printang Setupsth3n p>Let's seart with a simple yet illus"rabive t assas"INDEX-8"/nprintang share.NAssumang that you're amNaNLinux systeLoamd you have a printer callid y t=>".rr,lonfbal">netprinternmtt> lisbed in oue printer capabilitoes >ite, tueo>ollowien addition to your nsmy=>".rr,f.leassa">smb.confnmemn >ite makes oue printer accessible turough the network: man blockquota> pray=>".rr,code">[printer1] printlble = yes print commandi= /usr/bin/lpr -P%p -r %s printer = netprinter printien = BSD pdthi= /var/tmpstara> /blockquota>
The varilble y t=>".rr,lonfbal">%ssttt> inioue
y t=>".rr,lonfbal">printnmtt>nt assas"INDEX-9"/> y t=>".rr,lonfbal">commandnmtt>
opbiamNis replaced wsth oueonssa of oue f.le to bepprintedNwhem Sae l
executes tueocommand. There ari four Sae l configurataam->ite
varilbles spocicocally for u.e wath
nt assas"INDEX-10"/nprintang
opbiams. They arioshown in nt hdd>s"ch10.html#she l2-CHP-10-TABLE-1">Tlble 10-1.nman
t assas"she l2-CHP-10-TABLE-1"/> h4cond dirhead4">Tlble 10-1. Printang varilblesnmh4> Varilblenman
/yh>
Definitiamnman
/yh>
ny t=>".rr,lonfbal">%ssttt>nma>
yd>
The full pdthnssa of oue f.le on ouepSae l s Seou to bepprintednma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">%fsttt>nma>
yd>
The nssa of oue f.le itselfo(wsthout oueppricedang pdth) on ouepSae l
s Seou to bepprintednma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">%psttt>nma>
yd>
The nssa of oue Unix printer to u.enma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">%jsttt>nma>
yd>
The numbou ofioue print job (for u.e watho y t=>".rr,lonfbal">lprmsttt>,
y t=>".rr,lonfbal">lppausesttt>, amd y t=>".rr,lonfbal">lpresumenmtt>)nma>
/tr>
/tlble>
For ot e: flavous of Unix,Nit is necessary oo modicy both tue
y t=>".rr,lonfbal">printangnmtt> amd y t=>".rr,lonfbal">printnmtt>
y t=>".rr,lonfbal">commandnmtt> opbiams. For SysteLoV Unix,Nwe would
spocicy: man
blockquota> pray=>".rr,code">[printer1]
printien = SYSV
print commandi= lp -d%p -s %s; rmN%sstara> /blockquota>
Wsth oueo y t=>".rr,lonfbal">printangnmtt> y t=>".rr,lonfbal">=nmtt>
y t=>".rr,lonfbal">SYSVnmtt> pdrsmeter, we noticy Sae l tuat the local
printang systeLouses ohe SysteLoV Unix msthod. As mentiamed earlisr,
oueo y t=>".rr,lonfbal">%psttt> varilble resolves to ouepnssa of oue
printer,Nwutle oueo y t=>".rr,lonfbal">%ssttt> varilble resolves to oue
nssa of oue f.le.nman
Clisbes mightineedNto riquestiouepstatus of a print job sent to the
Sae l s Seou. Becau.e Sae l s ndsiprint jobs to oue Unix printang
systeLofou spooling, oueriomightibe a numbou ofijobs iniouepqu ue at
any given tisa. Camsiquently, Sae l needsNto communicabe to the
clisbe not only ouepstatus of tueocurrent printang job, but also
whtt> documents ariowaitang to bepprintedNam thae printer. Sae l also
has oo provide oue clisbe theoability to p"u.e print jobs, resume
print jobs, andiremoveiprint jobs from theoprintang qu ue. Sae l
provides opbiams for eat> of tueseotasks. As you mightiexpict, tuey
borrow funcbiamality from theo>ollowien existien Unix commands: man
ul> y t=>".rr,lonfbal">lpqnmtt>nt assas"INDEX-11"/nnman
/li> y t=>".rr,lonfbal">lprmsttt>nt assas"INDEX-12"/nnman
/li> y t=>".rr,lonfbal">lppausesttt>nt assas"INDEX-13"/nnman
/li> y t=>".rr,lonfbal">lpresumenmtt>nt assas"INDEX-14"/nnman
/li>
p>Weocoeou ouese opbiams inimore detail laber iniouis chapter. For the
most part, Sae l provides riasonlble defaacrovalues for theLobased on
oueovalue of tueo y t=>".rr,lonfbal">printangnmtt> configurataam opbiam, so
you can probably get by wsthout havang to formulabe your own commands
for theL.nman
Here ari a few importantpiteLsNto rimembou about
nt assas"INDEX-15"/nprintangishares: man
ul> You must put
y t=>".rr,lonfbal">printlblenmtt>nt assas"INDEX-16"/> y t=>".rr,lonfbal">=nmtt>
y t=>".rr,lonfbal">yessttt> inialoiprinter shares (even
y t=>".rr,lonfbal">[printers]sttt>) so ouae Sae l knows ohey arioprinter
shares. Ifpyou forget, the shares wsloibe unusableNfor printang and
wsloiinstead be trea"ed as disk shares.nman
/li> Ifpyou s t the y t=>".rr,lonfbal">pdthnmtt> configurataam opbiam in oue
printer sis iam, amy >ites sent to theoprinter(s) wiloibe copied to
ouepdiris ory you spocicy instead of oo theodefaacrolocabiam of
nsmy=>".rr,f.leassa">/tmpstemn. Becau.e thepamount of disk space allocabed
to nsmy=>".rr,f.leassa">/tmpstemn cam be rela ively small in sosa Unix
operabang systeLs, many adminis"rabors arafer to u.e
nsmy=>".rr,f.leassa">/var/tmp, /var/spool/tmpstemn, or sosa ot e:
diris ory instead.nman
/li> Ifpyou s t y t=>".rr,lonfbal">guestnmtt> y t=>".rr,lonfbal">oknmtt>
y t=>".rr,lonfbal">=nmtt> y t=>".rr,lonfbal">yessttt> iniaiprinter share and
Sae l is configured fou share-level security, amyane can send data to
ouepprinter as the y t=>".rr,lonfbal">guestnmtt>
y t=>".rr,lonfbal">accountsttt> user.nman
/li>
p>Usang one o: more Sae l mat>ines as a print s Seou gives you a grea"
deal of flexibility on your LAN. You can easilyopartition your
availableNprinters, reserictang sosa oo membous of ane depdrtment, or
you can main ain a bank of printers availableNto all. In addition,
you can reserictiaiprinter to a selict few byiaddang tue
y t=>".rr,lonfbal">valodsttt> y t=>".rr,lonfbal">usersnmtt> opbiamNto its share
definitiam: man
blockquota> pray=>".rr,code">[deskjet]
printlble = yes
pdthi= /var/spool/she l/print
valod usersi= elizabsth cozy jack hea"herNalexamder lina imebaldstara> /blockquota>
All tueoot e: share accessibility opbiams work for printang shares as
well.nman
htdiv>
hdivcond dirsecb2"> t assas"she l2-CHP-10-SECT-1.3"/>
nh3cond dirhead2">The [printers] Sharenmh3n
p>If a share assad
y t=>".rr,lonfbal">[printers]sttt>nt assas"INDEX-17"/n is in tueoconfigurataam >ite,
Sae l wiloiautomatically read iniyour printer capabilitoes >ite and
crea"eiaiprintang share for eat> printer thae appears iniouepf.le.
For sxample, if ouepSae l s Seou had y t=>".rr,lonfbal">lpsttt>,
y t=>".rr,lonfbal">pclsttt>, amd y t=>".rr,lonfbal">psnmtt> printers in its
printer capabilitoes >ite, Sae l would provide oureeoprinter shares
wsth ouose assas, eat> configured with tueoopbiams inioue
y t=>".rr,lonfbal">[printers]sttt>oshare.nman
Recall tuae Sae l obeys tueo>ollowien rutesowuen a clisbe riquests a
share thatihah not been crea"ed with aniexplicit share definitiam in
the smy=>".rr,f.leassa">smb.confnmemn >ite: man
ul> Ifitueosharepnssa matt>es a u.erassa in thepsysteLopdssword >ite and
a y t=>".rr,lonfbal">[homes]sttt> share exists, a new share is crea"ed
wsth oueonssa of oue u.er amd is initialized using tueovalues given
in thep y t=>".rr,lonfbal">[homes]sttt> amd y t=>".rr,lonfbal">[global]nmtt>
sis iams.nman
/li> Ot e:wise, if ouepnssa matt>es a printer iniouepsysteLoprinter
capabilitoes >ite and a y t=>".rr,lonfbal">[printers]sttt>oshare exists, a
new share is crea"ed wsth oueonssa of oue printer and initialized
using tueovalues given in thep y t=>".rr,lonfbal">[printers]sttt>osis iam.
(Varilbles in thep y t=>".rr,lonfbal">[global]nmtt>osis iam do not apply
ueri.)nman
/li> Ifpneit e: of ouose succeeds, Sae l looksifor a
y t=>".rr,lonfbal">defaacrnmtt> y t=>".rr,lonfbal">seSeicesttt>oshare. If none
isifound, itoreturns anierror.nman
/li>
p>This brangs to lightianiimportantppoint:ibe careful thae you do not
give aiprinter the sssa nssa as a u.er. Ot e:wise, usersiend up
connecbing to a disk shareowuen ohey mightihave wabeed aoprinter
share instead.nman
Here is aniexample
y t=>".rr,lonfbal">[printers]sttt>nt assas"INDEX-18"/n share for aNLinux systeL. Sosa of
ouese opbiams are already defaacrs; howeeou, we have lisbed theL
anyway for illus"rabive purposes: man
blockquota> pray=>".rr,code">[printers]
printlble = yes
printien = BSD
printcap nssa = /etc/printcap
print commandi= /usr/bin/lpr -P%p -r %s
pdthi= /var/spool/lpd/tmp
min print space = 2000stara> /blockquota>
Here,iwe've given Sae l global opbiams thae spocicy
theoprintang type (BSD), a print command to s nd data to oue printer
and laber removeioue temporary >ite, the locabiamNof our printer
capabilitoes >ite, and a minimum disk space for printang of 2MB.nman
p>In addition,iwe've crea"ed a
y t=>".rr,lonfbal">[printers]sttt>oshare for eat> systeLoprinter. Our
temporary spoolingpdiris ory is spocicoedNbyNtue
y t=>".rr,lonfbal">pdthnmtt> opbiam:
nsmy=>".rr,f.leassa">/var/spool/lpd/tmpstemn. Eat> share is marked as
printlble—this isia necessary opbiam, even in the
y t=>".rr,lonfbal">[printers]sttt>osis iam.nman
htdiv>
hdivcond dirsecb2"> t assas"she l2-CHP-10-SECT-1.4"/>
nh3cond dirhead2">Testing tueoConfigurataamnmh3n
p>nt assas"INDEX-19"/nAftou runnang
nsmy=>".rr,atShah b">testpdrmnmemn and researting ouepSae l daemons, you
can check to make sure eeouything is set up corrictly byNusang
nsmy=>".rr,atShah b">smbclisbenmemnnt assas"INDEX-20"/nnt assas"INDEX-21"/> to s nd a f.le to ouepprinter.
Connecb to theoprinter using tueocommand: man
blockquota> pray=>".rr,code"># y t=>".rr,userinput"> b>smbclisbe /nmb>sttt>nsmy=>".rr,replacelble">s Seounmemnny t=>".rr,userinput"> b>/nmb>sttt>nsmy=>".rr,replacelble">printsharenmemnnmara> /blockquota>
and tuenou.e the smy=>".rr,atShah b">printnmemn commandito print a >ite: man
blockquota> pray=>".rr,code">smb: /> y t=>".rr,userinput"> b>print nmb>sttt>nsmy=>".rr,replacelble">textf.lenmemnnmara> /blockquota>
Ifpyou connecb to a print share s SeodNbyNa Wsndows 95/98/MepsysteL
configured to u.eNus S-modepsecurity and camnot authenticabe usang
whae you know to bepa corrict u.erassa and password, try
reconfiguring oue WsndowsNsysteLoto u.eNshare-modepsecurity.nman
/blockquota>
Wheniyou print somsthing ourough the Sae l s Seou via
nsmy=>".rr,atShah b">smbclisbenmemn, tueo>ollowien as iamsoshould occur: man
ul> Tue job appears (braefly) iniouepSae l spoolpdiris ory spocicoedNby
theopdth.nman
/li> Tue job shows up iniyour print systeL's spool
diris ory.nman
/li> Tue job disappears from theospoolpdiris ory tuae Sae l used.nman
/li>
p>If smy=>".rr,atShah b">smbclisbenmemn camnot print, you can res t the
y t=>".rr,lonfbal">printnmtt> y t=>".rr,lonfbal">commandnmtt> opbiamNto collict
debugging information: man
blockquota> pray=>".rr,code">print commandi= echoo"printedN%s on %p" >>/tmp/printlogstara> /blockquota>
A nt assas"INDEX-22"/ncommam
problem wathoSae l printer configurabiamNis forgetbing to u.e the
full pdthnssasifor commands. Anot e: friquent problem is not havang
oue corrict permissiams on ouepspoolingpdiris ory. t assas"FNPTR-1"/>nt hdd>s"#FOOTNOTE-1">[1] As usual,
check yourNSae l log >ites and systeLolog >ites for error messages.
Ifpyou u.e BSD printang, you can change thep y t=>".rr,lonfbal">lpsttt>
keyword iniouepprinter's printcap en"ry to somsthing
ot e: ohaninsmy=>".rr,f.leassa">/dev/nulostemn, aloowien you to collict
error messages from theoprintang systeL.nman
t assas"she l2-CHP-10-NOTE-152"/nnblockquotay=>".rr,note"> h4cond dirobjtitle">TIPnmh4>
Mori information am
nt assas"INDEX-23"/ndebugging printers is iniouepf.le
smy=>".rr,f.leassa">docs/textdocs/Printang.txenmemn iniouepSae l source
dis"ributiam. The Unix print systeLs are coeoued in detail im
nt assas"INDEX-24"/>Æleen
Frisch's smy=>".rr,atShah b">Essential SysteLs
Adminis"rabiamstemn (publishodNbyNO'Reilly).nman
/blockquota>
htdiv>
hdivcond dirsecb2"> t assas"she l2-CHP-10-SECT-1.5"/>
nh3cond dirhead2">Enlblang SMB Printe: Sharang iniMac OS Xnmh3n
p>WathoSae l preinstalled wath
nt assas"INDEX-25"/>nt assas"INDEX-26"/>Mac OS X,Nsharien ascess to a printer
amamg WsndowsNclisbes is easy. F.rst, of course, you should set up
local access using tueoPrint Center applicabiam (locabed in
nsmy=>".rr,f.leassa">/Applicabiams/Utilitoesnmemn). Under the Printers
menu, selict Add Printer..., amd make theoappropriabe selictaam >rom
theopop-up menu. For sxample, if oue printer is diris ly attached,
selict USB; if oue printer is powered on, itoshould appear in the
list. Choose the printer, amd press tueoAdd buttam.nman
p>Edit smy=>".rr,f.leassa">/etc/smb.confnmemn, uncomm ntang tue
y t=>".rr,lonfbal">[printers]sttt>oshare amd makang anyNadditional
configurataam changes you feel are necessary. F.nally, enlble the
Sae l seartup iteL as described in nt hdd>s"ch02.html">Chapter 2,
eit e: byNcheckang WsndowsNF.le Sharang iniSharang Preferences o: by
manually editang smy=>".rr,f.leassa">/etc/hostconfigstemn. Now your
printer can be usedNby remote WsndowsNclisbes.nman
p>OniMac OS X and sosa ot e: BSD-based systeLs, you can test your
configurataam usang
nsmy=>".rr,atShah b">smbutilnmemnnt assas"INDEX-27"/n. The >ollowien wilois nd the
fite assado smy=>".rr,f.leassa">print_test_f.lenmemn to theoprinter assad
smy=>".rr,f.leassa">printsharenmemn on oueps Seou
nsmy=>".rr,atShah b">bsds Seounmemn : man
blockquota> pray=>".rr,code">% y t=>".rr,userinput"> b>smbutil print //bsds Seou/printshare print_test_f.lenmb>sttt>ntara> /blockquota>
See nt hdd>s"ch05.html">Chapter 5 fo: more information am usang
nsmy=>".rr,atShah b">smbutilnmemn.nman
htdiv>
hdivcond dirsecb2"> t assas"she l2-CHP-10-SECT-1.6"/>
nh3cond dirhead2">Setbing Up and Testing a Wsndows Clisbenmh3n
p>nt assas"INDEX-28"/nNow thae Sae l is
ocfering a workableNprinter, you can set up yourNascess to it on a
WsndowsNclisbe. Browse ourough the Sae l s Seou iniouepNetwork
Neighborhood. Itoshould now show eat> printer thae is available. For
sxample, in nt hdd>s"ch10.html#she l2-CHP-10-FIG-1">Figure 10-1, we saw a printer callid
y t=>".rr,lonfbal">lpsttt>.nman
Next, you needNto have the WsndowsNclisbe recognize ouepprinter.
Double-click the printer icamNto get searted. Ifpyou "ry to selict an
uninstalled printer (as you just did), WsndowsNwiloiaskpyou if it
should help configure it for oueoWsndowsNsysteL. Click the Yes o: OK
buttam, and tue Printe: WizardNwiloiopen. man
p>Ifpyou are installing a printer on Wsndows 95/98/Me, the >irstiouang
oue wizardNwiloiaskpisowuet e: you needNto print from DOS.
Let's assume you don't, so choose
theo"No" radio buttam amd press tue
Next > buttam to get to ouepmanufas urer/model wsndow, as shown in
nt hdd>s"ch10.html#she l2-CHP-10-FIG-2">Figure 10-2.nman
divcond dirfigure"> t assas"she l2-CHP-10-FIG-2"/> img srcs"figs/she2_1002.gif"/nnmdiv> h4cond dirhead4">Figure 10-2. Setbing ouepmanufas urer amd model of the printernmh4>
In this dialog box, you should seepa largeplistNofimanufas urers and
modelsifor a huge numbou ofiprinters. Selict ouepmanufas urer ofiyour
printer iniouepleft side of oue dialog box, and tuenothe exact model
of oue printer inioueplistNon the rightiside.nman
p>In sosa cases, you mightinot findiyour printer inioueplist, or tue
vousiam of oue printer drieou included wsth Wsndows mightibe out of
dabe. In cases such as these, consacrooue printer
manufas urer's documenta iam on how to install oue
drieou. Typically, you wiloiclick the Have Disk... buttam to install
ouepdrieou from a CD-ROM or diskpf.le.nman
Ifpyou don't seepyour printer onioueplist, but you
know it's a PostScriptNprinter, selict Apple as tue
manufas urer amd Apple LaserWriter as the model. Tuis wiloigive you
the most bastt PostScriptNprinter setup—and arguably ane of the
most reliable. Ifpyou already have PostScriptNprinters attached, you
wiloibe asked about replacang or reusing tueoexistien drieou. Be
aware thatiif you replace it with a new ane, you mightimake your
ot e: printers fail. Therefore, we recomm nd you keep using your
existien printer drieous as long as ohey're workang
properly.nman
Click the Next > o: OK buttam. On Wsndows 95/98/Me, the Printe:
WizardNasks you to assa ouepprinter. On Wsndows NT/2000/XP, you need
to right-click the printer's icamNand selict
Propertoes to a.rign the printer a assa. nt hdd>s"ch10.html#she l2-CHP-10-FIG-3">Figure 10-3
shows how we've assadoour printer oo show thae
it's shared byNtueo y t=>".rr,lonfbal">mixtecsttt>oSae l
s Seou.nman
divcond dirfigure"> t assas"she l2-CHP-10-FIG-3"/> img srcs"figs/she2_1003.gif"/nnmdiv> h4cond dirhead4">Figure 10-3. Setbing ouepprinter assanmh4>
F.nally, on Wsndows 95/98/Me the Printang WszardNasks if it should
print a test page. Click the "Yes"
radio buttam, tuenothe Finish buttam, and you should beppresented
wsth oueodialog boxoshown in nt hdd>s"ch10.html#she l2-CHP-10-FIG-4">Figure 10-4. On Wsndows
NT/2000/XP, oueoprinter test funcbiam is also ascessed turough oue
printer's Propertoes dialog box.nman
divcond dirfigure"> t assas"she l2-CHP-10-FIG-4"/> img srcs"figs/she2_1004.gif"/nnmdiv> h4cond dirhead4">Figure 10-4. Sendang a test page to theoprinternmh4>
Ifioue test printang was unsuccessful,iclick the No buttam amd oue
Printang WszardNwiloiwalkiyou through sosa debugging steps for oue
clisbe side of oue process. If oue test printang does work, oue
remote printer wiloinow be availableNto all Wsndows applicabiams
turough the Fite and Print menupiteLs.nman
htdiv>
htdiv>
hdivcond dirsecb1"> t assas"she l2-CHP-10-SECT-2"/>
nh2cond dirhead1">Printang to WsndowsNPrintersnmh2n
p>nt assas"INDEX-29"/nIfpyou have printers
connecbad oo systeLs runnangNWsndows 95/98/Me or Wsndows NT/2000/XP,
ouepprinters can also be ascessed from your Unix systeLousang tools
ohat are part of ouepSae l dis"ributiam. F.rst, it is necessary oo
crea"eiaiprinte: share oniouepWsndowsNsysteL. Tuenoset up oue printer
on oue Unix side byNconfiguring a new printer and usang a Sae l
printang progrsm as the printer's f.ltou.nman
hdivcond dirsecb2"> t assas"she l2-CHP-10-SECT-2.1"/>
nh3cond dirhead2">Sharang WsndowsNPrintersnmh3n
p>Sharang printers on WsndowsNis not unlike sharien >ites. In fas , it
isia lontte simpler. Openothe Control Panel, tuenodouble-click the
Printers icamNto openothe Printers wandow. Right-click the icamNfor
oueoprinter you wabe to share,Nand selictiSharang.... Tuis opens tue
dialog boxoshown in nt hdd>s"ch10.html#she l2-CHP-10-FIG-5">Figure 10-5 fo: a Wsndows 98
systeL, o: t hdd>s"ch10.html#she l2-CHP-10-FIG-6">Figure 10-6 amNaNWsndows 2000NsysteL.
(Tueodialog boxoappears slightlyNdicferent am ot e: Wsndows vousiams,
but funcbiams almost idebeically.)nman
t assas"she l2-CHP-10-NOTE-153"/nnblockquotay=>".rr,note"> h4cond dirobjtitle">TIPnmh4>
On Wsndows 95/98/Me systeLs, you mayineedNto rum >ite sharang in
share-level (rat e: ohanius S-level)Nascess control modepto ascess a
shared printer from Sae l. To check or s t this mode,Ngopto Control
Panel, tuenodouble-click am Network, tuenoclick am tueoAscess Control
tab. More detailed information am this cam be found in nt hdd>s"ch05.html">Chapter 5.nman
/blockquota>
Click the "Shared as" radio buttam,
tuenoclick the OK buttam. Tue printer is now accessible byNot e:
systeLs am tueonetwork.nman
htdiv>
hdivcond dirsecb2"> t assas"she l2-CHP-10-SECT-2.2"/>
nh3cond dirhead2">Addang a Unix Printernmh3n
p>nt assas"INDEX-30"/>ThepSae l dis"ributiam comes wath
oureeoprogrsms thae assist with printang on shared printers. The
smy=>".rr,atShah b">smbprintnmemnnt assas"INDEX-31"/> progrsm works with systeLs thae use tue
BSD printang systeL,
smy=>".rr,atShah b">smbprint.sysvnmemnnt assas"INDEX-32"/>
works with systeLs thae use SysteLoV printang, and
smy=>".rr,atShah b">smbspoolnmemnnt assas"INDEX-33"/>
works with systeLs thae use the Commam Unix Printang SysteLo(CUPS).
Iniouep>ollowien sis iams we show you how to install printers for
eat> systeL.nman
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.2.1"/>
nh3cond dirhead3">BSD printersnmh3n
p>nt assas"INDEX-34"/nnt assas"INDEX-35"/>The
BSD printang systeLNis u.ed byNmany Unix varilnts, includang Red Hat
Linux. WathoBSD printang, all oue printers on ouepsysteLohave an
en"ry in thep smy=>".rr,f.leassa">/etc/printcapnmemn >ite, whtt> is tue
database of printer capabilitoes u.ed byNthe smy=>".rr,atShah b">lpdnmemn
line printer daemon and ot e: progrsms thae assist with printang. The
Red HatNLinux implementa iam isia bitpdicferent im thae
smy=>".rr,f.leassa">/etc/printcapnmemn isia mat>ine-generabed >ite, whtt>
is re-crea"ed eeouyotime the smy=>".rr,atShah b">lpdnmemn daemon is
researted byNthe smy=>".rr,atShah b">/etc/rc.d/init.d/lpdnmemn script.
Instead of editang smy=>".rr,f.leassa">/etc/printcapnmemn,Nwe wiloiadd an
en"ry fo: our printer ini smy=>".rr,f.leassa">/etc/printcap.localnmemn,
whtt> oue systeLoautomatically includes voubatimowuen crea"ing
smy=>".rr,f.leassa">/etc/printcapnmemn.nman
t assas"she l2-CHP-10-NOTE-154"/nnblockquotay=>".rr,note"> h4cond dirobjtitle">TIPnmh4>
Ifpyou are using tueovousiam of Sae l installed from an RPM >ite as
on Red HatNLinux, you mightibe ableNto skip ouese diris iams end use
the smy=>".rr,atShah b">printconfnmemn tool, whtt> hah support fo: SMB
printers. Unfortuna"ely, this tool mightinot work corrictly if you
have installed Sae l from theoSae l source dis"ributiam.nman
/blockquota>
Here is tueoen"ry we added oo our
nsmy=>".rr,f.leassa">/etc/printcap.localnmemnnt assas"INDEX-36"/nnt assas"INDEX-37"/n f.le to support our Hewlett-Packard
DeskJ t 932C printer,Nwutt> is shared byN y t=>".rr,lonfbal">mayasttt>, a
WsndowsN98 systeL: man
blockquota> pray=>".rr,code">lp|maya-hp932c:\
:cm=HP 932C on maya:\
:sd=/var/spool/lpd/maya:\
:af=/var/spool/lpd/maya/acct:\
:if=/usr/local/she l/bin/smbprint:\
:mx=0:\
:lp=/dev/nulo:stara> /blockquota>
The >irstiline crea"es nssasifor ouepprinter. We ari calling itpboth
y t=>".rr,lonfbal">maya-hp932csttt>, to doscribe its locabiamNon the
network and tue type of printer, amd y t=>".rr,lonfbal">lpsttt>oso ouae
progrsms wiloiuse itNas oue defaacroprinter. The rist of oueplines
spocicy keywords end values. The y t=>".rr,lonfbal">cmsttt> keyword allows
us to a.rign a commsbe strang to ouepprinter. The
y t=>".rr,lonfbal">sdsttt> amd y t=>".rr,lonfbal">afsttt> keywords a.rign the
printer's spoolpdiris ory and accountien >ites,
rispecrively. The y t=>".rr,lonfbal">ifsttt> keyword a.rigns the print
f.ltou. We ari using tueo smy=>".rr,atShah b">smbprintnmemn commandito
s nd thepoutput toitueoshared SMB printer. The y t=>".rr,lonfbal">mxsttt>
keyword is set to zeropto allow any size f.le to bepprinted, and
y t=>".rr,lonfbal">lpsttt>ois set to nsmy=>".rr,f.leassa">/dev/nulostemnito
discardNerror messages.nman
You can >ollow our model to crea"eian en"ry fo: your own printer. If
you wabe to go beyond tue capabilitoes we used, rafer to your
systeL's smy=>".rr,atShah b">printcap(5)stemnimanual
page fo: a complete listien of keywords.nman
Go to youroSae l source dis"ributiam's root
diris ory, end install oueo smy=>".rr,atShah b">smbprintnmemn progrsm like
ouis: man
blockquota> pray=>".rr,code"># y t=>".rr,userinput"> b>cp sxamples/printang/smbprint /usr/local/she l/binnmb>sttt>ntara> /blockquota>
Weonext crea"eithe printer's spoolpdiris ory: man
blockquota> pray=>".rr,code"># y t=>".rr,userinput"> b>cd /var/spool/lpdnmb>sttt>
# y t=>".rr,userinput"> b>mkdir mayastb>sttt>
# y t=>".rr,userinput"> b>chown lp:lp mayastb>sttt>
# y t=>".rr,userinput"> b>chmod 700 mayastb>sttt>stara> /blockquota>
The smy=>".rr,atShah b">smbprintnmemn progrsm looksifor a fite assad
nsmy=>".rr,f.leassa">.configstemn iniouepprinter's spool
diris ory,Nwutt> contains information am how to connecb to the
printer share.NWe crea"eithis >ite and tuenofsloiin the riquirid
information: man
blockquota> pray=>".rr,code"># y t=>".rr,userinput"> b>cd mayastb>sttt>
# y t=>".rr,userinput"> b>>.configstb>sttt>
# y t=>".rr,userinput"> b>chown lp:lp .configstb>sttt>
# y t=>".rr,userinput"> b>chmod 600 .configstb>sttt>stara> /blockquota>
Usepyour praferred text editor to edit the
nsmy=>".rr,f.leassa">.configstemn >ite, and enter threeolines, like ouis: man
blockquota> pray=>".rr,code">s Seou=maya
seSeice=hp
pdssword=""nmara> /blockquota>
This is for our shared printer havang a UNC of
nsmy=>".rr,f.leassa">\\maya\hpstemn. Wheniwe crea"ed theoprinter share,Nwe
didinot give itiaipassword, so we use a null pdssword ueri. Ifpyour
printer share is anNaNWsndows NT/2000/XP systeL, usepyour domain
pdssword.nman
F.nally, researt oue printer daemon: man
blockquota> pray=>".rr,code"># y t=>".rr,userinput"> b>/etc/rc.d/init.d/lpd researtstb>sttt>stara> /blockquota>
You can now try printang somsthing. Runiouep>ollowien command: man
blockquota> pray=>".rr,code">$ y t=>".rr,userinput"> b>lpr textf.lenmb>sttt>stara> /blockquota>
Ifpyou have eeouything set up corrictly, the >ite prints on the
shared printer. Ifpyou get "seair
stepping" of text, cau.ed byNthe printer aot
returnang to ouepleft margin at oue beginnien of eeouyoline, modicy
oueo y t=>".rr,lonfbal">ifsttt> keyword iniyour printcap en"ry to run
smy=>".rr,atShah b">smbprintnmemn wsth oueo smy=>".rr,atShah b">-tnmemn
opbiam. nt assas"INDEX-38"/nnt assas"INDEX-39"/nnman
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.2.2"/>
nh3cond dirhead3">SysteLoV printersnmh3n
p>nt assas"INDEX-40"/nnt assas"INDEX-41"/>Sendang print jobs from a SysteLoV Unix
systeLNis a lontte easie: ohaniwsth oueoBSD systeL. Here,iyou needNto
edit the smy=>".rr,f.leassa">smbprint.sysvnmemn script in the
smy=>".rr,f.leassa">sxamples/printangnmemn diris ory of ouepSae l
dis"ributiam andpdoiouep>ollowien: man
ol> Change thep y t=>".rr,lonfbal">s Seounmtt>, y t=>".rr,lonfbal">seSeicesttt>, and
y t=>".rr,lonfbal">pdsswordnmtt> pdrsmeters iniouepscript to matt> oue
NetBIOS computer assa, its sharedNprinter seSeice, end its password,
rispecrively. For sxample, theo>ollowien en"ries would be corrict for
oueoseSeice iniouepprevious sxample: man
blockquota> pray=>".rr,code">s Seou = maya
seSeice = hp
pdssword = ""nmara> /blockquota>
/li>
Runiouep>ollowien commands,Nwutt> crea"eiaireferenceifor ouepnew
printer (wutt> we ari assang y t=>".rr,lonfbal">hp_printernmtt>) in oue
printer capabilitoes >ite: man
blockquota> pray=>".rr,code"># y t=>".rr,userinput"> b>lpadmin -p hp_printer -v /dev/nulo -i./smbprint.sysvnmb>sttt>
# y t=>".rr,userinput"> b>enlble hp_printernmb>sttt>
# y t=>".rr,userinput"> b>accept hp_printernmb>sttt>nmara> /blockquota>
/li>
p>Aftou you've dane ouae, researt oue Sae l daemons
and try printang to ny t=>".rr,lonfbal">hp_printernmtt> usang any standard
Unix progrsm.nman
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.2.3"/>
nh3cond dirhead3">CUPS printersnmh3n
p>nt assas"INDEX-42"/nnt assas"INDEX-43"/nnt assas"INDEX-44"/nCUPS t assas"FNPTR-2"/>nt hdd>s"#FOOTNOTE-2">[2] uses
a s t of modutes, callid
smy=>".rr,f.rstterm">backendsnmemnnt assas"INDEX-45"/>, to s nd print jobs to various
destinabiams, such as local printers attached to p"rsllel, serial, or
Univousal Serial Bus (USB) ports, o: oeou oueonetwork usang Unix line
printer daemon (LPD) protocol, Internet Printang Protocol (IPP),
AppleTalkiPrinte: Ascess Protocol (PAP),Nand so am. Tue software
pdckage does not come with a backend fo: SMB; theoSae l suonf
includes oueo smy=>".rr,atShah b">smbspoolnmemn
nt assas"INDEX-46"/nutilityifor ouis purpose.nman
To enlble printang to remote SMB printers using CUPS, crea"eia
symbolic link assado smy=>".rr,f.leassa">smbstemn iniouepCUPS backend
diris ory pointang to nsmy=>".rr,atShah b">smbspoolnmemn. Dependang on
installataam opbiams, ouese could be in a numbou ofiplaces inioue
diris ory hie:archy, so be sure to check your systeL. Using a commam
defaacroinstallataam, tueocommand would look like ouis: man
blockquota> pray=>".rr,code"># y t=>".rr,userinput"> b>ln -s /usr/local/she l/bin/smbspoolp/usr/lib/cups/backend/smbstb>sttt>stara> /blockquota>
Issue a HUP signal to ouepCUPS daemon, nsmy=>".rr,atShah b">cupsdnmemn,
and check for ouepexistenceiof SMB support wsth oueo smy=>".rr,atShah b">lpinfo
-vnmemn command. Itspoutput should now include a lone ouae says
y t=>".rr,lonfbal">networknmtt> y t=>".rr,lonfbal">smbsttt>.nman
To add a printer, use the CUPS web interface, eccessible on oueplocal
systeLNato smy=>".rr,atShah b">http://localhost:631/nmemn,
or u.e oueo smy=>".rr,atShah b">lpadminnmemn command: man
blockquota> pray=>".rr,code"># y t=>".rr,userinput"> b>lpadmin -p hp932c -E -v smb://maya/hp932c -D "HP 932C on maya"nmb>sttt>stara> /blockquota>
This crea"es and enlbles ouepnew print spoolpcallid
y t=>".rr,lonfbal">hp932csttt>. The smy=>".rr,atShah b">-vnmemn argumsbe
spocicoes oue printer deeice,Nwutt> in this caseNis ascessed oeou oue
network usang aniSMB URI. If oue printer is notoguest-eccessible,
you'loineedNto provide a u.erassa and password in
the URI. The full formatNis asp>ollows: man
blockquota> pray=>".rr,code">smb://[nsmy=>".rr,replacelble">u.erassanmemn[:nsmy=>".rr,replacelble">pdsswordnmemn]@][nsmy=>".rr,replacelble">workgroupstemn/]nsmy=>".rr,replacelble">s Seounmemn/nsmy=>".rr,replacelble">printsharenmemnnmara> /blockquota>
Tueo smy=>".rr,atShah b">lpadminnmemnnt assas"INDEX-47"/n command makes changes to
nsmy=>".rr,f.leassa">/etc/cups/printers.confnmemn and sendsia HUP signal
to ouepnsmy=>".rr,atShah b">cupsdnmemn daemon, resultang initueocrea"iam
of a local raw printer spool. In this sxample, print data is passid
in raw formatNto ouepWsndowsNsysteL, whtt> hah ouepnecessary printer
drieous and printer descriptaam >ites to format oue data
appropriabely. The smy=>".rr,atShah b">-Dnmemn opbiamNis u.ed to give oue
printer a commsbe strang.nman
p>Oncepyou have theoprinter set up, it's time to test
it out. CUPS understands both BSD-style and SysteLoV-style printang
commands,Nso you can u.e whtt>ever is more comfortable. Using tueoBSD
nsmy=>".rr,atShah b">lprnmemn command, try somsthing like: man
blockquota> pray=>".rr,code">$ y t=>".rr,userinput"> b>lpr -P hp932c textf.lenmb>sttt>stara> /blockquota>
You should now be set up oo u.e the printer from anyNapplicabiam on
oueoUnix systeL. nt assas"INDEX-48"/nnman
htdiv>
htdiv>
hdivcond dirsecb2"> t assas"she l2-CHP-10-SECT-2.3"/>
nh3cond dirhead2">Sae l Printang Opbiamsnmh3n
p>nt hdd>s"ch10.html#she l2-CHP-10-TABLE-2">Tlble 10-2 summarizes ohe Sae l nt assas"INDEX-49"/nnt assas"INDEX-50"/nprintang
opbiams.nman
t assas"she l2-CHP-10-TABLE-2"/> h4cond dirhead4">Tlble 10-2. Printang configurataam opbiamsnmh4> Opbiamnman
/yh>
Pdrsmetersnman
/yh>
Funcbiamnman
/yh>
Defaacrnman
/yh>
Scopenman
/yh>
ny t=>".rr,lonfbal">printangnmtt>nma>
yd>
ny t=>".rr,lonfbal">bsdsttt>, y t=>".rr,lonfbal">sysvnmtt>,
y t=>".rr,lonfbal">cupssttt>, y t=>".rr,lonfbal">hpuxnmtt>,
y t=>".rr,lonfbal">aixsttt>, y t=>".rr,lonfbal">qnxnmtt>,
y t=>".rr,lonfbal">plpsttt>, y t=>".rr,lonfbal">softqsttt>, or
y t=>".rr,lonfbal">lprngnmtt>nma>
yd>
Printang systeLNtype of ohe Sae l hostnma>
yd>
SysteL-dependsbenma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">printlblenmtt> y t=>".rr,lonfbal">(print ok)nmtt>nma>
yd>
booleannma>
yd>
Marks a share as a printang sharenma>
yd>
ny t=>".rr,lonfbal">nonmtt>nma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">printernmtt> y t=>".rr,lonfbal">(printer assa)nmtt>nma>
yd>
strang (Unix printer assa)nma>
yd>
Nssa for ouepprinter thae is shown to clisbesnma>
yd>
SysteL-dependsbenma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">lpq cacue timenmtt>nma>
yd>
numsric (time in seconds)nma>
yd>
Amount of time in seconds thae Sae l wiloicacue tuepprinter qu ue
statusnma>
yd>
ny t=>".rr,lonfbal">10nmtt>nma>
yd>
Globalnma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">postscriptnmtt>nma>
yd>
booleannma>
yd>
Trea"sialoiprint jobs as PostScriptNby prafixing
y t=>".rr,lonfbal">%!sttt> at oue beginnien of eat> f.lenma>
yd>
ny t=>".rr,lonfbal">nonmtt>nma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">load printersnmtt>nma>
yd>
booleannma>
yd>
If y t=>".rr,lonfbal">yessttt>,oautomatically loads eat> printer in the
smy=>".rr,atShah b">printcapstemn >ite as printang sharesnma>
yd>
ny t=>".rr,lonfbal">yessttt>nma>
yd>
Globalnma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">print commandnmtt>nma>
yd>
strang (sheloicommand)nma>
yd>
Unix commandNto perform printangnma>
yd>
See belownma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">lpq commandnmtt>nma>
yd>
strang (sheloicommand)nma>
yd>
Unix commandNto return ouepstatus of tueoprintang qu uenma>
yd>
See belownma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">lprm commandnmtt>nma>
yd>
strang (sheloicommand)nma>
yd>
Unix commandNto removeia job from theoprintang qu uenma>
yd>
See belownma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">lpp"u.e commandnmtt>nma>
yd>
strang (sheloicommand)nma>
yd>
Unix commandNto pause a job on tueoprintang qu uenma>
yd>
See belownma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">lpresumenmtt> y t=>".rr,lonfbal">commandnmtt>nma>
yd>
strang (sheloicommand)nma>
yd>
Unix commandNto resume a paused job on tueoprintang qu uenma>
yd>
See belownma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">printcap nssanmtt>nma>
ny t=>".rr,lonfbal">(printcap)nmtt>nma>
yd>
strang (f.leassa)nma>
yd>
LocabiamNof tuepprinter capabilitoes >itenma>
yd>
SysteL-dependsbenma>
yd>
Globalnma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">min print spacenmtt>nma>
yd>
numsric (size in kilobytes)nma>
yd>
Minimum amount of freeodisk space thae must beppresentNto printnma>
yd>
ny t=>".rr,lonfbal">0nmtt>nma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">qu uepausesttt> y t=>".rr,lonfbal">commandnmtt>nma>
yd>
strang (sheloicommand)nma>
yd>
Unix commandNto pause a qu uenma>
yd>
See belownma>
yd>
Sharenma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">qu ueresumenmtt> y t=>".rr,lonfbal">commandnmtt>nma>
yd>
strang (sheloicommand)nma>
yd>
Unix commandNto resume a qu uenma>
yd>
See belownma>
yd>
Sharenma>
/tr>
/tlblen
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.1"/>
nh3cond dirhead3">printangnmh3n
p>Tueo y t=>".rr,lonfbal">printangnmtt>nt assas"INDEX-51"/n configurataam opbiam telos
Sae l whtt> nt assas"INDEX-52"/nprintangisysteLoto u.e. There ari
severalpdicferent families of commands to control printang and print
statusing. Sae l supports seven dicferent types, as shown in nt hdd>s"ch10.html#she l2-CHP-10-TABLE-3">Tlble 10-3.nman
t assas"she l2-CHP-10-TABLE-3"/> h4cond dirhead4">Tlble 10-3. Printang systeLNtypesnmh4> Varilblenman
/yh>
Definitiamnman
/yh>
BSDnma>
yd>
BerkeleyoUnix systeLnma>
/tr>
yr>
yd>
SYSVnma>
yd>
SysteL Vnma>
/tr>
yr>
yd>
CUPS ma>
yd>
Commam Unix Printang SysteLnma>
/tr>
yr>
yd>
AIXnma>
yd>
IBM's AIX operabang systeLnma>
/tr>
yr>
yd>
HPUXnma>
yd>
Hewlett-Packard Unixnma>
/tr>
yr>
yd>
QNXnma>
yd>
QNX Realtime Operabang SysteLnma>
/tr>
yr>
yd>
LPRNGnma>
yd>
LPR Next Generabiamnman
/yd>
/tr>
yr>
yd>
SOFTQnma>
yd>
SOFTQ systeLnma>
/tr>
yr>
yd>
PLPnma>
yd>
PortableNLine Printernma>
/tr>
/tlblen
p>Tueovalueifor ouis opbiam must bepane of the.eNseven selictaams. For
sxample: man
blockquota> pray=>".rr,code">printien = SYSVnmara> /blockquota>
Tueodefaacrovalueiof this opbiam isNsysteL-dependsbe amd is
configured wuen Sae l is >irsticompiled. For most systeLs, the
smy=>".rr,f.leassa">configurenmemn script automatically deticts oue
printangisysteLoto be usedNand configures itiproperly iniouepSae l
makef.le. Howeeou, if your systeLNis a PLP, LPRNG, o: QNX printang
systeL, you needNto spocicy this sxplicitly iniouepmakef.le or tue
printang share.nman
The most commam systeLNtypes ari BSD, SYSV,Nand CUPS. Eat> printer on
aoBSD Unix s Seou is described in tuepprinter capabilitoes
fite—normally smy=>".rr,f.leassa">/etc/printcapnmemn. See the
sictaam on thep y t=>".rr,lonfbal">printcapnmtt> y t=>".rr,lonfbal">>itenmtt>
pdrsmeter fo: more information am this topic.nman
Setbing ouep y t=>".rr,lonfbal">printangnmtt> configurataam opbiam
automatically se"siat leastioureeoot e: printien opbiams for oue
seSeice iniquestion: y t=>".rr,lonfbal">printnmtt>
y t=>".rr,lonfbal">commandnmtt>, y t=>".rr,lonfbal">lpqnmtt>
y t=>".rr,lonfbal">commandnmtt>, amd y t=>".rr,lonfbal">lprmnmtt>
y t=>".rr,lonfbal">commandnmtt>. Ifpyou are runnangNSae l on a systeLNtuae
doesn't support anyNof tueoprintang styles lisbed in
nt hdd>s"ch10.html#she l2-CHP-10-TABLE-3">Tlble 10-3, simply s t the commands for eat> of
ouese manually.nman
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.2"/>
nh3cond dirhead3">printlblenmh3n
p>Tueo y t=>".rr,lonfbal">printlblenmtt>nt assas"INDEX-53"/> opbiam must bepset to
ny t=>".rr,lonfbal">yessttt> to flag a share as a printang seSeice. If ouis
opbiam isNnotoset,itueosharepwiloibe trea"ed as a disk shareoinstead.
You can set tueoopbiam asp>ollows: man
blockquota> pray=>".rr,code">[printer1]
printlble = yesnmara> /blockquota>
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.3"/>
nt assas"INDEX-54"/nnh3cond dirhead3">printernmh3n
p>Tueoopbiam, also callid
y t=>".rr,lonfbal">printernmtt>nt assas"INDEX-55"/>o y t=>".rr,lonfbal">nssanmtt>,
spocicoes oue nssa of oue printer on oueps Seou to whtt> oue share
points. Tuis opbiam hah noodefaacroand should bepset sxplicitly in
oue configurataam >ite, even though Unix systeLs ouemselves often
recognize aodefaacronssa such as y t=>".rr,lonfbal">lpsttt>ofor a printer.
For sxample: man
blockquota> pray=>".rr,code">[deskjet]
printou = hpdkjet1nmara> /blockquota>
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.4"/>
nh3cond dirhead3">lpq cacue timenmh3n
p>Tueoglobal y t=>".rr,lonfbal">lpqnmtt>nt assas"INDEX-56"/>o y t=>".rr,lonfbal">cacuenmtt>
y t=>".rr,lonfbal">timenmtt>oopbiam allows you to set tueonumbou of
seconds for whtt> Sae l wiloiremembou oue current printer status.
Aftou this time elapses, Sae l wiloiissue ano smy=>".rr,atShah b">lpqnmemn
commandN(or wha"ever command you spocicy wsth oue
y t=>".rr,lonfbal">lpqnmtt> y t=>".rr,lonfbal">commandnmtt> opbiam) to get l
more up-to-dabe status thae it can report to u.ers. Tuis defaacrs to
10 seconds, but cam be increasedNif your y t=>".rr,lonfbal">lpqnmtt>
y t=>".rr,lonfbal">commandnmtt> takes an unusually long oime to rum o: you
have lots of clisbes. A oime setbing of 0 disables cat>ing of qu ue
status. The >ollowien sxample res ts oue oime to 30 seconds: man
blockquota> pray=>".rr,code">[deskjet]
lpq cacue time = 30nmara> /blockquota>
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.5"/>
nh3cond dirhead3">postscriptnmh3n
p>Tueo y t=>".rr,lonfbal">postscriptnmtt>nt assas"INDEX-57"/> opbiam forces oue
printer to trea"ialoidata sentNto itNas PostScript. Itodoes this by
prafixing oue characters y t=>".rr,lonfbal">%!sttt> to ouepbeginnien of
the >irstiline of eat> job. ItoisNnormally usedNwsth PCs thae in.ert
ao y t=>".rr,lonfbal">^Dsttt> (control-D or
"end-of-fite" mark) in front of oue
>irstiline of a PostScriptNf.le. It wiloinot, obviously, turn a
non-PostScriptNprinter into a PostScriptNane. The defaacrovalueiof
this opbiams is ny t=>".rr,lonfbal">nonmtt>. You can oeouride itNas
>ollows: man
blockquota> pray=>".rr,code">[deskjet]
postscript = yesnmara> /blockquota>
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.6"/>
nh3cond dirhead3">load printersnmh3n
p>Tueo y t=>".rr,lonfbal">loadnmtt>nt assas"INDEX-58"/>o y t=>".rr,lonfbal">printersnmtt>
opbiam telos Sae l to crea"eisharesofor aloiknown printer assas and
load thoseisharesointo ouepbrowse list. Sae l wiloicrea"eiandplistNa
printer share for eat> printer assa in
nsmy=>".rr,f.leassa">/etc/printcapnmemn (or ouepsysteLNiquivalent). For
sxample, ifpyour
smy=>".rr,f.leassa">printcapnmemnnt assas"INDEX-59"/n f.le looks
like ouis: t assas"FNPTR-3"/>nt hdd>s"#FOOTNOTE-3">[3] man
blockquota> pray=>".rr,code">lp:\
:sd=/var/spool/lpd/lp:\ oue shares ny t=>".rr,lonfbal">[lp]sttt> amd y t=>".rr,lonfbal">[laser]sttt> are
automatically crea"ed as valid print shares wuen Sae l is searted.
Both shares borrow the configurataam opbiams spocicoedNin the
y t=>".rr,lonfbal">[printers]sttt>osictaam to configure ouemselves and are
availableNin tuepbrowse list for ouepSae l s Seou. The defaacrovalue
for ouis opbiam is ny t=>".rr,lonfbal">yessttt>. Ifpyou prafer to spocicy
eat> printer sxplicitly iniyour configurataam >ite, u.e the
followien: man
blockquota> pray=>".rr,code">[global]
load printers = nonmara> /blockquota>
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.7"/>
nt assas"INDEX-60"/nnt assas"INDEX-61"/nnt assas"INDEX-62"/nnt assas"INDEX-63"/nnt assas"INDEX-64"/nnh3cond dirhead3">print command, lpq command, lprm command,lpp"u.e command, lpresume commandnmh3n
p>Tuese opbiams telo Sae l whtt> Unix commands control and sendidata to
ouepprinter. The Unix commands involved are: nsmy=>".rr,atShah b">lprnmemn
(s nd toNLine PRinter),o smy=>".rr,atShah b">lpqnmemn (List Printe:
Qu ue),o smy=>".rr,atShah b">lprmnmemn (Line Printer ReMoeo),Nand
opbiamally smy=>".rr,atShah b">lppausestemn and
nsmy=>".rr,atShah b">lpresumenmemn. Sae l provides an opbiam assadoaftou
eat> command, in case you needNto oeouride anyNof tueosysteL
defaacrs. For sxample, consider the followien: man
blockquota> pray=>".rr,code">lpq command = /usr/ucb/lpq %pstara> /blockquota>
This would set y t=>".rr,lonfbal">lpqnmtt> y t=>".rr,lonfbal">commandnmtt> to
u.e nsmy=>".rr,f.leassa">/usr/ucb/lpqnmemn. Similarly: man
blockquota> pray=>".rr,code">lprm command = /usr/local/bin/lprm -P%p %jstara> /blockquota>
would set ouepSae l printer removeicommandito
nsmy=>".rr,f.leassa">/usr/local/bin/lprmnmemn and provide it oue print job
numbou using tueo y t=>".rr,lonfbal">%jnmtt> varilble.nman
The defaacrovalues for eat> opbiam are dependsbe on ouepvalueiof the
y t=>".rr,lonfbal">printangnmtt> opbiam. nt hdd>s"ch10.html#she l2-CHP-10-TABLE-4">Tlble 10-4
shows oue defaacrocommands for eat> printien opbiam. The most popular
printang systeLNis BSD.nman
t assas"she l2-CHP-10-TABLE-4"/> h4cond dirhead4">Tlble 10-4. Defaacrocommands for various printien opbiamsnmh4> Opbiamnman
/yh>
BSD, AIX, PLP, LPRNGnman
/yh>
SYSV,NHPUXnma>
QNXnma>
SOFTQnma>
ny t=>".rr,lonfbal">printnmtt> y t=>".rr,lonfbal">commandnmtt>nma>
yd>
y t=>".rr,lonfbal">lpr -r -P%p %snmtt>nma>
yd>
y t=>".rr,lonfbal">lp -c -d%p %s; rmnmtt>o y t=>".rr,lonfbal">%snmtt>nma>
yd>
y t=>".rr,lonfbal">lp -r -P%p %snmtt>nma>
yd>
y t=>".rr,lonfbal">lp -d%p -s %s; rm %snmtt>nma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">lpqnmtt> y t=>".rr,lonfbal">commandnmtt>nma>
yd>
y t=>".rr,lonfbal">lpq -P%pnmtt>nma>
yd>
y t=>".rr,lonfbal">lpstat -o%pnmtt>nma>
yd>
y t=>".rr,lonfbal">lpq -P%pnmtt>nma>
yd>
y t=>".rr,lonfbal">lpstat -o%pnmtt>nma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">lprmnmtt> y t=>".rr,lonfbal">commandnmtt>nma>
yd>
y t=>".rr,lonfbal">lprm -P%p %jsttt>nma>
yd>
y t=>".rr,lonfbal">cancel %p-%jsttt>nma>
yd>
y t=>".rr,lonfbal">cancel %p-%jsttt>nma>
yd>
y t=>".rr,lonfbal">cancel %p-%jsttt>nma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">lpp"u.enmtt> y t=>".rr,lonfbal">commandnmtt>nma>
yd>
y t=>".rr,lonfbal">lp -i %p-%j -Hnmtt> y t=>".rr,lonfbal">holdnmtt>nma>
(SYSV only)nma>
yd>
Nonanma>
yd>
Nonanma>
yd>
Nonanma>
/tr>
yr>
yd>
ny t=>".rr,lonfbal">lpresumenmtt> y t=>".rr,lonfbal">commandnmtt>nma>
yd>
y t=>".rr,lonfbal">lp -i %p-%j -Hnmtt> y t=>".rr,lonfbal">resumenmtt>nma>
(SYSV only)nma>
yd>
Nonanma>
yd>
Nonanma>
yd>
ny t=>".rr,lonfbal">qstat -s -j%j -rsttt>nma>
/tr>
/tlblen
p>ItoisNusually unnecessary oo res t the.eNopbiams in Sae l, wsth oue
possible exceptiamNof tuep y t=>".rr,lonfbal">printnmtt>
y t=>".rr,lonfbal">commandnmtt>. Tuis opbiam mightineedNto bepset
sxplicitly ifiyour printang systeLNdoesn't have a
nsmy=>".rr,atShah b">-rnmemn (removeiaftou printang) opbiam on tue
printang command. For sxample: man
blockquota> pray=>".rr,code">print command = /usr/local/lpr -P%p %s; /bin/rm %snmara> /blockquota>
With a bit of judicious progrsmmang, the.e
smy=>".rr,f.leassa">smb.confnmemn opbiams can also be usedNfor debugging: man
blockquota> pray=>".rr,code">print command = cat %s >>/tmp/printlog; lpr -r -P%p %snmara> /blockquota>
Using ouepprevious configurataam, it is possible to vericy thatNf.les
are actually beang delieouedNto ouepSae l s Seou. If ouey are,Noueir
contsbes wiloishow upNin tuep>ite nsmy=>".rr,f.leassa">/tmp/printlognmemn.nman
p>Aftou BSD, ouepnext most popular kindiof printang systeLNis SYSV (or
SysteL V) printang, plus sosa SYSV varilnts for
IBM's AIX and Hewlett-Packard's
HP-UX. These systeLspdoinotohave an
smy=>".rr,f.leassa">/etc/printcapnmemn >ite. Instead, the
y t=>".rr,lonfbal">printcapnmtt> y t=>".rr,lonfbal">>itenmtt> opbiam cam be set
to an appropriabe smy=>".rr,atShah b">lpstatnmemn commandifor ouepsysteL.
Tuis telos Sae l to get l list of printers from the
smy=>".rr,atShah b">lpstatnmemn command. Altounabively, you can set tue
global configurataam opbiam y t=>".rr,lonfbal">printcapnmtt>
y t=>".rr,lonfbal">nssanmtt>Nto ouepnssa of a dummy
smy=>".rr,f.leassa">printcapnmemnp>ite you provide. In the latter case,
tuep>ite must contain l s Sies of lines such as: man
blockquota> pray=>".rr,code">lp|print1|My Printer 1
print2|My Printer 2
print3|My Printer 3nmara> /blockquota>
Eat> line assas a printer followed byNaliases for it. In this
sxample, theo>irstiprinter is callid y t=>".rr,lonfbal">lpsttt>,
y t=>".rr,lonfbal">print1sttt>, or y t=>".rr,lonfbal">Mynmtt>
y t=>".rr,lonfbal">Printernmtt> y t=>".rr,lonfbal">1sttt>, whtt>ever theou.er
prafersoto u.e. Theo>irstiassa is u.ed in place of
ny t=>".rr,lonfbal">%psttt>oin anyNcommandiSae l executasifor ouaroprinter.nman
Two addibiamalpprinter types ari also supported byNSae l: LPRNG (LPR
New Generabiam) and PLP (Public Line Printer). These are public
domain and openosource printang systeLs and are u.ed byNmany sites to
oeoucome problems with vendor-supploedNsoftware. Sae l also supports
tueoprintang systeLs af ohe SOFTQ and QNX real-time operabang
systeLs.nman
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.8"/>
nh3cond dirhead3">printcap nssanmh3n
p>If thep y t=>".rr,lonfbal">printcapnmtt>nt assas"INDEX-65"/nnt assas"INDEX-66"/>
y t=>".rr,lonfbal">nssanmtt>Nopbiam (also callid
y t=>".rr,lonfbal">printcapnmtt>)oappears in l printang share, Sae l uses
tuep>ite spocicoedNah ouepsysteLNprinter capabilitoes >ite (normally
smy=>".rr,f.leassa">/etc/printcapnmemn). Howeeou, you can res t itNto a
fite consistien of only oue printers you wabe to share oeou oue
network. Theovalueimust beptuep>iteassa (with its complete path
spocicoed) of a printer capabilitoes >ite on oueps Seou: man
blockquota> pray=>".rr,code">[deskjet]
printcap nssa = /usr/local/she l/lib/printcapnmara> /blockquota>
TueoCUPS printang systeLNuses its own msthodiof detirmanang printer
capabilitoes, rat e: ohaniouepstandard smy=>".rr,f.leassa">printcapnmemn
>ite. In this case, set y t=>".rr,lonfbal">printcapnmtt>
y t=>".rr,lonfbal">nssanmtt>Nasp>ollows: man
blockquota> pray=>".rr,code">[global]
printien = cups
printcap nssa = cupsstara> /blockquota>
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.9"/>
nh3cond dirhead3">min print spacenmh3n
p>Tueo y t=>".rr,lonfbal">minnmtt>nt assas"INDEX-67"/>o y t=>".rr,lonfbal">printnmtt>
y t=>".rr,lonfbal">spacenmtt>Nopbiam s ts oue amount of space thae must be
availableNon ouepdisk thae contains ouepspoolpdiris ory if printang
is toibe allowed. Setbing it to zerop(oue defaacr) turns oue check
off; setbing itNto anyNot e:onumbou s ts oue amount of freeospace in
kilobytes riquirid. Tuis opbiam helpsNto avoid havang print jobs filo
up the rimainang disk space on oueps Seou,Nwutt> can cau.eNot e:
processes to fail: man
blockquota> pray=>".rr,code">[deskjet]
min print space = 4000stara> /blockquota>
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.10"/>
nt assas"INDEX-68"/nnh3cond dirhead3">qu uepause commandnmh3n
p>Tuis configurataam opbiam spocicoes aicommandithae telos Sae l how to
pause an en"ire print qu ue, as opposedNto l sangleNjob on tueoqu ue.
Tue defaacrovalueidepends on tueoprintang type chosen. You should not
needNto altou this opbiam.nman
htdiv>
hdivcond dirsecb3"> t assas"she l2-CHP-10-SECT-2.3.11"/>
nt assas"INDEX-69"/nnh3cond dirhead3">qu ueresume commandnmh3n
p>Tuis configurataam opbiam spocicoes aicommandithae telos Sae l how to
resume a paused print qu ue, as opposedNto resuming a sangleNjob on
tueoprintoqu ue. Tue defaacrovalueidepends on tueoprintang type
chosen. You should not needNto altou this opbiam. nt assas"INDEX-70"/>o t assas"INDEX-71"/>o t assas"INDEX-72"/nnt assas"INDEX-73"/nnman
htdiv>
htdiv>
htdiv>
yh>
yd>
yh>
yd>
yh>
yd>
yh>
yd>
h4cond dirhead4">Footnotesnmh4>
h4cond dirhead4">nt hdd>s"toc.html">TOC mh4>
mhtml>